<?php

/**
 * Illustration form.
 *
 * @package    espace14
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class IllustrationForm extends BaseIllustrationForm
{
  public function configure()
  {
	$this->setWidgets(array(
	'description'=> new sfWidgetFormInputHidden(),
	'nom'          => new sfWidgetFormTextarea(),
	'presentation' => new sfWidgetFormInputHidden(),
    'url_video'    => new sfWidgetFormTextarea(),
    'url_resource' => new sfWidgetFormInputFile(),
	));
	 $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nom'          => new sfValidatorString(array('max_length' => 1000,'required' => false)),
	  'presentation' => new sfValidatorString(array('max_length' => 1000,'required' => false)),
      'description'  => new sfValidatorString(array('max_length' => 3000, 'required' => false)),
      'url_video'    => new sfValidatorString(array('max_length' => 1000,'required' => false)),
      'url_resource' => new sfValidatorFile(array('required' => false,
  		            // 20 megabytes in bytes
  		            'max_size' => '20971520')),
    ));

    $this->widgetSchema->setNameFormat('illustration[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::configure();
  }
}
